package com.qf.fmall2202.useraddr.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qf.fmall2202.useraddr.entity.UserAddr;
import com.qf.fmall2202.useraddr.service.UserAddrService;
import com.qf.fmall2202.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户地址  前端控制器
 * </p>
 *
 * @author 徐英海
 * @since 2022-11-08
 */
@CrossOrigin
@RestController
@RequestMapping("/useraddr")
public class UserAddrController {
    @Autowired
    private UserAddrService userAddrService;

    @GetMapping("/list")
    public ResultVo list(@RequestParam("userId") String userId) {
        List<UserAddr> userAddrList = userAddrService.list(new LambdaQueryWrapper<UserAddr>().eq(UserAddr::getUserId, userId));
        return ResultVo.ok("查询成功", userAddrList);
    }
}
